import React from 'react'
import { Outlet, Link, NavLink } from "react-router-dom"
//NavLink可以自动使当前点击的按钮高亮显示
//如果有二级路由,需要占位,link支持路由点击跳转link代替a标签,to属性代替href,link会被解析为a标签
export default function Main() {
  return (
    <div id="root">
      <div>
        <div className="row">
          <div className="col-xs-offset-2 col-xs-8">
            <div className="page-header"><h2>React Router Demo</h2></div>
          </div>
        </div>
        <div className="row">
          <div className="col-xs-2 col-xs-offset-2">
            <div className="list-group">
              {/* <Link className="list-group-item" to="/main/about">About</Link>
              <Link className="list-group-item" to="/main/home">Home</Link> */}
              <NavLink className="list-group-item" to="/main/about">About</NavLink>
              <NavLink className="list-group-item" to="/main/home">Home</NavLink>
            </div>
          </div>
          <div className="col-xs-6">
            <div className="panel">
              <div className="panel-body">
                <Outlet />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

  )
}
